//
//  ViewController.swift
//  ios
//
//  Created by sysadmin on 2023/2/12.
//

import UIKit
import WebKit
 
class ViewController: UIViewController, WKUIDelegate {
 
    var webView:WKWebView!
    
    override func loadView() {
        let webConfiguration = WKWebViewConfiguration();
        webView = WKWebView(frame: .zero, configuration: webConfiguration)
        webView.uiDelegate = self;
        view = webView;
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()
        let myURL = Bundle.main.url(forResource: "index", withExtension: "html")
        webView.load(URLRequest(url: myURL!));
    }
    
    func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
            webView.evaluateJavaScript("displayDate()") { (any, error) in
                if (error != nil) {
                    print(error ?? "err")
                }
            }
        }
 
}

